#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from pybloom_live import ScalableBloomFilter


class Contact(object):
    '''
    表结构
    '''
    nameId = 'nameId'
    contact = 'contact'  # 联系方式   str
    contactType = 'contactType'  # 联系类型 int
    contactName = 'contactName'  # 联系人名称 str
    name = 'name'  # 企业名称 str
    contactSource = 'contactSource'  # 联系人来源 str
    contactPageLink = 'contactPageLink'  # 联系人页面链接 str
    contactNameMd5 = 'contactNameMd5'  # 联系人名称md5 str
    contactChannelList = 'contactChannelList'
    contactPageImage = 'contactPageImage'  # 页面快照 str
    create_time = 'create_time'  # 创建时间 datetime
    import_update_time = 'import_update_time'  # 最新更新时间 datetime


class RobotConfig(object):
    '''
    机器人配置，对应各统计脚本，便于统一管理
    命名规范:
    脚本前缀_web_hook_url
    脚本前缀_title
    '''
    # 联系方式群正式机器人
    dsf_s2_web_hook_url = 'https://oapi.dingtalk.com/robot/send?access_token=6a732fad118e7d46b1662b2c9a623591e1441e637de8ae9fb528d30ce449f2ba'
    dsf_s2_title = u'联系方式周报数据监控'


class MongoQueryConfig(object):
    '''
    查询mongo的配置，每个配置方法对应一个统计、导出脚本，
    写在一起主要是为了借鉴起来方便
    命名规范：脚本前缀_tj\dc_config
    '''
    col_name = 'col_name'
    filter = 'filter'
    projection = 'projection'
    limit = 'limit'
    skip = 'skip'

    @staticmethod
    def dsf_s2_tj_config(_min, _max):
        config = {
            MongoQueryConfig.col_name: 'contact',
            MongoQueryConfig.filter: {
                'contactType': {"$in": [0, 1, 2]},
                "$or": [
                    {'import_update_time': {"$lte": _max, "$gte": _min}},
                    {'create_time': {"$lte": _max, "$gte": _min}}
                ]

            },
            MongoQueryConfig.projection: ["nameId", "isBaiduContact", "contact", "contactType", "contactSource",
                                          "import_update_time",
                                          "create_time", "contactChannelList"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s4_tj_config(_min, _max):
        config = {
            MongoQueryConfig.col_name: 'contact_tmp',
            MongoQueryConfig.filter: {
                # 'contactType': 0,
                "$or": [
                    {'import_update_time': {"$lte": _max, "$gte": _min}},
                    {'create_time': {"$lte": _max, "$gte": _min}}
                ]

            },
            MongoQueryConfig.projection: ["nameId", "contact",
                                          "contactType", "import_update_time", "create_time"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s10_dc_config():
        config = {
            MongoQueryConfig.col_name: 'contact',
            MongoQueryConfig.filter: {
                "contactChannelList.contactSource": re.compile(r'atobo$'),
                "isBaiduContact": True,

            },
            MongoQueryConfig.projection: ["contact", "nameId", "create_time", "_id", "contactChannelList",
                                          "contactType", "import_update_time", "name"]
        }
        return config

    @staticmethod
    def dsf_s11_tj_config(_min, _max):
        config = {
            MongoQueryConfig.col_name: 'enterprise_annual_report',
            MongoQueryConfig.filter: {
                # 'contactType': 0,
                "$or": [
                    {'import_update_time': {"$lte": _max, "$gte": _min}},
                    {'create_time': {"$lte": _max, "$gte": _min}}
                ]

            },
            MongoQueryConfig.projection: ["nameId", "arPhn", "import_update_time", "create_time"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s12_tj_config(_min, _max):
        config = {
            MongoQueryConfig.col_name: 'bidding',
            MongoQueryConfig.filter: {
                # 'biddingProjectContact.nameId': {"$exists": True},
                # 'biddingProjectContact.contactType': 0,
                "$or": [
                    {'import_update_time': {"$lte": _max, "$gte": _min}},
                    {'create_time': {"$lte": _max, "$gte": _min}}
                ]

            },
            MongoQueryConfig.projection: ["biddingProjectContact", "import_update_time", "create_time"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s13_tj_config(_min, _max):
        config = {
            MongoQueryConfig.col_name: 'recruiting',
            MongoQueryConfig.filter: {
                "$or": [
                    {'import_update_time': {"$lte": _max, "$gte": _min}},
                    {'create_time': {"$lte": _max, "$gte": _min}}
                ]

            },
            MongoQueryConfig.projection: ["recruitingContact", "nameId", "import_update_time", "create_time"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s14_tj_config(_min, _max):
        config = {
            MongoQueryConfig.col_name: 'business',
            MongoQueryConfig.filter: {
                "$or": [
                    {'import_update_time': {"$lte": _max, "$gte": _min}},
                    {'create_time': {"$lte": _max, "$gte": _min}}
                ]

            },
            MongoQueryConfig.projection: ["b2bContact", "nameId", "import_update_time", "create_time"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s15_dc_config():
        config = {
            MongoQueryConfig.col_name: 'enterprise',
            MongoQueryConfig.filter: {

            },
            MongoQueryConfig.projection: ['operStatus', 'enterpriseType', 'socialCreditCode', '_id']
        }
        return config

    @staticmethod
    def dsf_s16_dc_config():
        config = {
            MongoQueryConfig.col_name: 'contact',
            MongoQueryConfig.filter: {
                'contactType': 0,
                'contact': 'Z13WLRnePv5KXFSJp+aR7A==',
            },
            # 如果需要全部字段，则只需注释projection，否则只会有 ’_id‘
            # MongoQueryConfig.projection: []
        }
        return config

    @staticmethod
    def dsf_s17_dc_config():
        config = {
            MongoQueryConfig.col_name: 'business',
            MongoQueryConfig.filter: {
                'b2bSource': 'hunt007',
                'b2bContact': {"$exists": True}
            },
            MongoQueryConfig.projection: ["b2bPageUrl", "b2bContact"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s19_dc_config():
        config = {
            MongoQueryConfig.col_name: 'contact',
            MongoQueryConfig.filter: {
                "OriginalPageStatus": 1,
                "GWPageErrorReason": {'$exists': True},
            },
            MongoQueryConfig.projection: ["contact", "nameId", "name", "OriginalPageStatus", "contactType",
                                          "contactChannelList", "GWPageErrorReason"]
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s20_dc_config():
        config = {
            MongoQueryConfig.col_name: 'business',
            MongoQueryConfig.filter: {
                'b2bSource': '51sole',
                'b2bContact': {"$exists": True}
            },
            MongoQueryConfig.projection: ["b2bPageUrl", "b2bContact"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s21_dc_config():
        config = {
            MongoQueryConfig.col_name: 'business',
            MongoQueryConfig.filter: {
                'b2bSource': 'zhaozhaoqu',
                'b2bContact': {"$exists": True}
            },
            MongoQueryConfig.projection: ["b2bPageUrl", "b2bContact"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s22_tj_config():
        config = {
            MongoQueryConfig.col_name: 'contact',
            MongoQueryConfig.filter: {
                'contactType': [0, 1, 2]
            },
            MongoQueryConfig.projection: ['contactType'],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s23_dc_config(_min, _max):
        config = {
            MongoQueryConfig.col_name: 'business',
            MongoQueryConfig.filter: {
                'create_time': {"$lte": _max, "$gte": _min},
                'b2bContact': {"$exists": True},

            },
            MongoQueryConfig.projection: ["b2bContact", "nameId"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s24_tj_config(_min, _max):
        config = {
            MongoQueryConfig.col_name: 'business',
            MongoQueryConfig.filter: {
                'b2bContact': {"$exists": True},
                'nameId': {'$exists': False},
                'create_time': {"$lte": _max}

            },
            MongoQueryConfig.projection: ["b2bContact", "nameId"],
        }
        return config

    @staticmethod
    def dsf_s25_dc_config():
        config = {
            MongoQueryConfig.col_name: 'business',
            MongoQueryConfig.filter: {
                'b2bSource': 'czvv',
                'b2bContact': {"$exists": True}
            },
            MongoQueryConfig.projection: ["b2bPageUrl", "b2bContact"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s26_dc_config(_min, _max):
        config = {
            MongoQueryConfig.col_name: 'enterprise_annual_report',
            MongoQueryConfig.filter: {
                # 'contactType': 0,
                "$or": [
                    {'import_update_time': {"$lte": _max, "$gte": _min}},
                    {'create_time': {"$lte": _max, "$gte": _min}}
                ]

            },
            MongoQueryConfig.projection: ["nameId", "arPhn", "import_update_time", "create_time"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s28_dc_config(_min, _max):
        config = {
            MongoQueryConfig.col_name: 'recruiting',
            MongoQueryConfig.filter: {
                '$and': [
                    {"nameId": {"$exists": True}},
                    {"$or": [
                        {'create_time': {"$lte": _max, "$gte": _min}},
                        {'import_update_time': {"$lte": _max, "$gte": _min}}
                    ]},
                    {"$or": [
                        # {'recruitingDesc': {"$exists": True}},
                        {'recruitingContact': {"$exists": True}},
                        {'recruitingDesc': {'$regex': re.compile(r"\d{11}")}},
                    ]},

                ],

            },
            MongoQueryConfig.projection: ["nameId", "recruitingPageUrl", "recruitingDesc", "recruitingContact",
                                          "recruitingSource", "recruitingPageImage", "import_update_time",
                                          "create_time"],
            # MongoQueryConfig.limit: 5000
            # MongoQueryConfig.limit: 100
        }
        return config

    @staticmethod
    def dsf_s29_dc_config():
        config = {
            MongoQueryConfig.col_name: 'contact',
            MongoQueryConfig.filter: {
                "$or": [
                    {"contactPageLink": {'$regex': re.compile(r'sf-item\.taobao')}},
                    {"contactChannelList.contactPageLink": {'$regex': re.compile(r'sf-item\.taobao')}},
                ]

            },
            MongoQueryConfig.projection: ["contact", "nameId", "create_time", "_id", "contactChannelList",
                                          "contactType", "import_update_time", "name"],
        }
        return config

    @staticmethod
    def dsf_s30_dc_config():
        config = {
            MongoQueryConfig.col_name: 'contact',
            MongoQueryConfig.filter: {
                "$or": [
                    {"contactChannelList.contactSource": 'taobao'},
                    {"contactSource": 'taobao'}
                ]

            },
            MongoQueryConfig.projection: ["contact", "nameId", "create_time", "_id", "contactChannelList",
                                          "contactType", "import_update_time", "name","isBaiduContact"],
            # MongoQueryConfig.limit: 200
        }
        return config

    @staticmethod
    def dsf_s31_dc_config():
        config = {
            MongoQueryConfig.col_name: 'enterprise',
            MongoQueryConfig.filter: {
            },
            MongoQueryConfig.projection: ['name','_id'],
            # MongoQueryConfig.limit: 800000
        }
        return config

    @staticmethod
    def dsf_s32_tj_config(_min, _max):
        config = {
            MongoQueryConfig.col_name: 'contact_baidu',
            MongoQueryConfig.filter: {
                'create_time': {"$lte": _max, "$gte": _min}

            },
            MongoQueryConfig.projection: ["nameId", "arPhn", "import_update_time", "create_time"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s33_tj_config():
        config = {
            MongoQueryConfig.col_name: 'business',
            MongoQueryConfig.filter: {
                'b2bSource': {"$in": ['hc360','b2b_baidu','1688']}
            },
            MongoQueryConfig.projection: ["b2bSource","b2bServiceYear", "b2bContact", "nameId", "b2bEntityType",'b2bLinkAccessible','b2bPageUrl','b2bEnterpriseName'],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s36_tj_config():
        config = {
            MongoQueryConfig.col_name: 'business',
            # MongoQueryConfig.filter: {
            #     'b2bSource': {"$in": ['hc360', 'b2b_baidu', '1688']}
            # },
            MongoQueryConfig.projection: ["b2bSource"],
            # MongoQueryConfig.limit: 20000
        }
        return config

    @staticmethod
    def dsf_s41_dc_config():
        config = {
            MongoQueryConfig.col_name: 'contact_baidu',
            MongoQueryConfig.filter: {

            },
            # MongoQueryConfig.projection: ["contact", "nameId", "create_time", "_id", "contactChannelList",
            #                               "contactType", "import_update_time", "name"]
        }
        return config


class Field:
    '''
    支持int和bloom类型的值，如果是其他类型的值，不能用该类进行表示
    '''

    def __init__(self, name='', annotation="", prioties=-1, is_dup=False, value=0):
        self.name = name  # str 统计的键名
        self.annotation = annotation  # str 键名对应的含义
        self._is_dup = is_dup  # bool，统计时是否去重
        self.prioties = prioties  # int  输出的优先级，越小越优先输出
        if not isinstance(value, (int, ScalableBloomFilter)):
            raise Exception('Field.value just accept int or bloom')
        self.value = value

    def __lt__(self, other):
        return self.prioties < other.prioties

    @property
    def is_dup(self):
        return self._is_dup

    @property
    def title(self):
        return self.annotation

    def __str__(self):
        return self.name

    def __repr__(self):
        return self.name


class BaseResultConfig:
    '''
    只会处理prioties大于0的Field，
    只会处理name非空的Field
    '''

    @staticmethod
    def trun_to_sort_ls():
        '''
        将类变量的Field类型存为列表，并返回
        @return:list of Field
        '''
        new_sort_ls = []
        for name in dir(ResultConfig):
            field = getattr(ResultConfig, name)
            if isinstance(field, Field):
                if field.prioties > 0:
                    new_sort_ls.append(field)
        new_sort_ls.sort()
        return new_sort_ls

    @staticmethod
    def trun_to_mk_text(log_after_prioties):
        '''
        将排序后的 list of Field 转为mk_text
        @param result_dic: 统计的结果dict
        @return: str
        '''
        mk_text = ''
        new_sort_ls = BaseResultConfig.trun_to_sort_ls()
        for field in new_sort_ls:
            value = None
            if field.name:
                if isinstance(field.value, int):
                    value = field.value
                elif isinstance(field.value, ScalableBloomFilter):
                    value = field.value.count
                else:
                    raise Exception('Field.value just accept int or bloom')
                mk_text += '**{}：{}**  \n'.format(field.title, value)
                if field.prioties in log_after_prioties:
                    mk_text += '**=================**  \n'
        return mk_text


class ResultConfig(BaseResultConfig):
    # 需要在这些prioties后加上 log line
    log_after_prioties = [16, 31, 46]

    all_table_count = Field('all_table_count', annotation="库内联系方式总量", prioties=1, value=100)  # 库内联系方式总量(未去重)
    all_update = Field('all_update', annotation='库内周更新量')
    all_add = Field('all_add', annotation='库内周新增量')
    all_abs_add = Field('all_abs_add', annotation='库内绝对新增', is_dup=True)  # (contactChannelList为1的)

    mobile_update = Field('mobile_update', annotation='库内手机周更新数量', prioties=11)
    mobile_update_dup = Field('mobile_update_dup', annotation='手机周更新企业数量', is_dup=True, prioties=12)
    mobile_add = Field('mobile_add', annotation='库内手机周新增量', prioties=13)
    mobile_add_dup = Field('mobile_add_dup', annotation='库内手机周新增企业量', is_dup=True, prioties=14)
    mobile_abs_add = Field('mobile_abs_add', annotation='库内手机周绝对新增量', prioties=15)
    mobile_abs_add_ent_dup = Field('mobile_abs_add_ent_dup', annotation='库内手机周绝对新增企业量',
                                   is_dup=True, prioties=16)  # 周绝对新增企业数量 todo 可能存在性能问题
    phone_update = Field('phone_update', annotation='库内固话周更新数量', prioties=26)
    phone_update_dup = Field('phone_update_dup', annotation='固话周更新企业数量', is_dup=True, prioties=27)
    phone_add = Field('phone_add', annotation='库内固话周新增量', prioties=28)
    phone_add_dup = Field('phone_add_dup', annotation='库内固话周新增企业量', is_dup=True, prioties=29)
    phone_abs_add = Field('phone_abs_add', annotation='库内固话周绝对新增量', prioties=30)
    phone_abs_add_ent_dup = Field('phone_abs_add_ent_dup', annotation='库内固话周绝对新增企业量',
                                  is_dup=True, prioties=31)  # 周绝对新增企业数量 todo 可能存在性能问题

    email_update = Field('email_update', annotation='库内邮箱周更新数量', prioties=41)
    email_update_dup = Field('email_update_dup', annotation='邮箱周更新企业数量', is_dup=True, prioties=42)
    email_add = Field('email_add', annotation='库内邮箱周新增量', prioties=43)
    email_add_dup = Field('email_add_dup', annotation='库内邮箱周新增企业量', is_dup=True, prioties=44)
    email_abs_add = Field('email_abs_add', annotation='库内邮箱周绝对新增量', prioties=45)
    email_abs_add_ent_dup = Field('email_abs_add_ent_dup', annotation='库内邮箱周绝对新增企业量',
                                  is_dup=True, prioties=46)  # 周绝对新增企业数量 todo 可能存在性能问题

    # -------------新增--------
    # 可能存在手机号重复的情况，即多家企业拥有同一个手机号，以后再对手机号进行去重
    one_month_mobile_update = Field("one_month_mobile_update", annotation='近一个月手机更新数量', prioties=5)
    one_month_mobile_update_dup = Field("one_month_mobile_update_dup", annotation='近一个月手机更新企业数量', is_dup=True,
                                        prioties=6)
    one_month_phone_update = Field("one_month_phone_update", annotation='近一个月固话更新数量', prioties=20)
    one_month_phone_update_dup = Field("one_month_phone_update_dup", annotation='近一个月固话更新企业数量', is_dup=True,
                                       prioties=21)
    one_month_email_update = Field("one_month_email_update", annotation='近一个月邮箱更新数量', prioties=35)
    one_month_email_update_dup = Field("one_month_email_update_dup", annotation='近一个月邮箱更新企业数量', is_dup=True,
                                       prioties=36)

    two_month_mobile_update = Field("two_month_mobile_update", annotation='近2个月手机更新数量', prioties=7)
    two_month_mobile_update_dup = Field("two_month_mobile_update_dup", annotation='近2个月手机更新企业数量', is_dup=True,
                                        prioties=8)
    two_month_phone_update = Field("two_month_phone_update", annotation='近2个月固话更新数量', prioties=22)
    two_month_phone_update_dup = Field("two_month_phone_update_dup", annotation='近2个月固话更新企业数量', is_dup=True,
                                       prioties=23)

    two_month_email_update = Field("two_month_email_update", annotation='近2个月邮箱更新数量', prioties=37)
    two_month_email_update_dup = Field("two_month_email_update_dup", annotation='近2个月邮箱更新企业数量', is_dup=True,
                                       prioties=38)

    three_month_mobile_update = Field("three_month_mobile_update", annotation='近3个月手机更新数量', prioties=9)
    three_month_mobile_update_dup = Field("three_month_mobile_update_dup", annotation='近3个月手机更新企业数量', is_dup=True,
                                          prioties=10)
    three_month_phone_update = Field("three_month_phone_update", annotation='近3个月固话更新数量', prioties=24)
    three_month_phone_update_dup = Field("three_month_phone_update_dup", annotation='近3个月固话更新企业数量', is_dup=True,
                                         prioties=25)

    three_month_email_update = Field("three_month_email_update", annotation='近3个月邮箱更新数量', prioties=39)
    three_month_email_update_dup = Field("three_month_email_update_dup", annotation='近3个月邮箱更新企业数量', is_dup=True,
                                         prioties=40)
    # 在营总量统计
    zy_enterprise_count = Field("zy_enterprise_count", annotation='在营企业的数量', is_dup=True, prioties=47)
    zy_enterprise_mobile_count = Field("zy_enterprise_mobile_count", annotation='在营企业的手机条数', prioties=48)
    week_zy_enterprise_mobile_update = Field("week_zy_enterprise_mobile_update", annotation='周更新在营企业的手机条数', prioties=52)
    week_zy_enterprise_mobile_add = Field("week_zy_enterprise_mobile_add", annotation='周新增在营企业的手机条数', prioties=53)
    week_zy_enterprise_mobile_abs_add = Field("week_zy_enterprise_mobile_abs_add", annotation='周绝对新增在营企业的手机量',
                                              is_dup=True, prioties=54)  # 在营企业的手机数量周绝对新增
    one_month_zy_enterprise_mobile_update = Field("one_month_zy_enterprise_mobile_update",
                                                  annotation='近一个月更新在营企业的手机条数', prioties=49)  # 在营企业的手机数量近一个月更新
    two_month_zy_enterprise_mobile_update = Field("two_month_zy_enterprise_mobile_update", annotation='近2个月更新在营企业的手机条数',
                                                  prioties=50)
    three_month_zy_enterprise_mobile_update = Field("three_month_zy_enterprise_mobile_update",
                                                    annotation='近3个月更新在营企业的手机条数', prioties=51)

    zy_enterprise_phone_count = Field("zy_enterprise_phone_count", annotation='在营企业的固话条数')
    week_zy_enterprise_phone_update = Field("week_zy_enterprise_phone_update", annotation='周更新在营企业的固话条数')
    week_zy_enterprise_phone_add = Field("week_zy_enterprise_phone_add", annotation='周新增在营企业的固话条数')
    week_zy_enterprise_phone_abs_add = Field("week_zy_enterprise_phone_abs_add", annotation='周绝对新增在营企业的固话量',
                                             is_dup=True)  # 在营企业的固话数量周绝对新增
    one_month_zy_enterprise_phone_update = Field("one_month_zy_enterprise_phone_update",
                                                 annotation='近一个月更新在营企业的固话条数')  # 在营企业的固话数量近一个月更新
    two_month_zy_enterprise_phone_update = Field("two_month_zy_enterprise_phone_update",
                                                 annotation='近2个月更新在营企业的固话条数')
    three_month_zy_enterprise_phone_update = Field("three_month_zy_enterprise_phone_update",
                                                   annotation='近3个月更新在营企业的固话条数')

    zy_enterprise_email_count = Field("zy_enterprise_email_count", annotation='在营企业的邮箱条数')
    week_zy_enterprise_email_update = Field("week_zy_enterprise_email_update", annotation='周更新在营企业的邮箱条数')
    week_zy_enterprise_email_add = Field("week_zy_enterprise_email_add", annotation='周新增在营企业的邮箱条数')
    week_zy_enterprise_email_abs_add = Field("week_zy_enterprise_email_abs_add", annotation='周绝对新增在营企业的邮箱量',
                                             is_dup=True)  # 在营企业的邮箱数量周绝对新增
    one_month_zy_enterprise_email_update = Field("one_month_zy_enterprise_email_update",
                                                 annotation='近一个月更新在营企业的邮箱条数')  # 在营企业的邮箱数量近一个月更新
    two_month_zy_enterprise_email_update = Field("two_month_zy_enterprise_email_update",
                                                 annotation='近2个月更新在营企业的邮箱条数')
    three_month_zy_enterprise_email_update = Field("three_month_zy_enterprise_email_update",
                                                   annotation='近3个月更新在营企业的邮箱条数')

    # 全表数量统计
    table_mobile_count = Field("table_mobile_count", annotation='库内手机条数总量', prioties=2)
    table_mobile_count_dup = Field("table_mobile_count_dup", annotation='库内手机号总量', is_dup=True, prioties=3)
    table_mobile_count_ent_dup = Field('table_mobile_count_ent_dup', annotation='库内手机映射企业数量', is_dup=True, prioties=4)
    table_phone_count = Field("table_phone_count", annotation='库内固话条数总量', prioties=17)
    table_phone_count_dup = Field('table_phone_count_dup', annotation='库内固话号码总量', is_dup=True, prioties=18)
    table_phone_count_ent_dup = Field('table_phone_count_ent_dup', annotation='库内固话映射企业数量', is_dup=True, prioties=19)
    table_email_count = Field("table_email_count", annotation='库内邮箱条数总量', prioties=32)
    table_email_count_dup = Field('table_email_count_dup', annotation='库内邮箱号总量', is_dup=True, prioties=33)
    table_email_count_ent_dup = Field('table_email_count_ent_dup', annotation='库内邮箱映射企业数量', is_dup=True, prioties=34)

    # save_result_dic可以放入类变量中，避免传参调用导致逻辑混乱


if __name__ == '__main__':
    print(MongoQueryConfig.dsf_s10_dc_config())
    bloom = ScalableBloomFilter()
    ResultConfig.all_table_count.value += 100
    ResultConfig.email_add_dup.value = bloom
    ResultConfig.email_add_dup.value.add(1)
    ResultConfig.email_add_dup.value.add(2)
    ResultConfig.email_add_dup.value.add(2)
    print(ResultConfig.all_table_count.value)
    resultConfig = ResultConfig()
    print(resultConfig.all_table_count.value)
    print(resultConfig.trun_to_sort_ls()[0].value)
    print(ResultConfig.trun_to_sort_ls()[0].value)
    print(ResultConfig.trun_to_mk_text(ResultConfig.log_after_prioties))
